package com.jsyl.lwbk.web.controller.business;

import com.jsyl.lwbk.business.domain.IntegrationTrainAmount;
import com.jsyl.lwbk.business.service.IntegrationTrainAmountService;
import com.jsyl.lwbk.common.core.controller.BaseController;
import com.jsyl.lwbk.common.core.page.TableDataInfo;
import com.jsyl.lwbk.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/business/integrationTrainAmount")
public class IntegrationTrainAmountController extends BaseController {

    private String prefix = "business/integration";

    @Autowired
    IntegrationTrainAmountService integrationTrainAmountService;

    @Autowired
    ISysUserService sysUserService;

    @GetMapping("/list/{projectCode}")
    public String trainingProgram(@PathVariable("projectCode") String projectCode,ModelMap mmap) {
        mmap.put("projectCode", projectCode);
        return prefix + "/integrationTrainAmountList";
    }

    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo findChildList(@RequestParam String projectCode) {
        startPage();
        List<IntegrationTrainAmount> list = integrationTrainAmountService.findList(projectCode);
        return getDataTable(list);
    }

    @GetMapping("/listByChild")
    @ResponseBody
    public List<IntegrationTrainAmount> listByChild(@RequestParam Long childId, @RequestParam String projectCode) {
        List<IntegrationTrainAmount> list = integrationTrainAmountService.listByChild(childId,projectCode);
        return list;
    }

}
